import type { LoginApiParams, LoginApiResponse, RoleListResponse, TableListParams, TableListResponse } from "../type/ApiType";
import type { UploadFinishedParams } from "../type/FilmCreate";
import request from "./Request";

// 登录验证
export const loginApi = (data: LoginApiParams) => request.post<LoginApiResponse>('/login', data)

// 获取用户权限列表
export const roleListApi = (userid: number) => request.post<RoleListResponse>('/users/jurisdiction', userid)

// 获取表格列表数据
export const tableListApi = (params: TableListParams) => request.get<TableListResponse>('/user/list', { params })

// 上传
export const uploadApi = (data: ArrayBuffer, hashName: string) => request.post('/film/upload', data, {
  headers: {
    'X-File-Name': hashName
  }
})
// 结束上传
export const uploadFinishedApi = (data: UploadFinishedParams) => request.post('/film/uploadfinished', data)
